//package com.allwees.bs.c.module.order.context.util;
//
//import com.allwees.bs.c.module.order.annotation.ValidateUser;
//import com.allwees.bs.c.module.order.dto.OrderDTO;
//import com.allwees.bs.c.module.order.dto.OrderItemDTO;
//import com.allwees.bs.core.model.useraction.constant.EActionType;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//
///**
// *
// *
// * @author yangylsky
// * @since 2020-03-28
// *
// */
//
//@Slf4j
//@Component
//public class OrderLogActionUtil {
////	public static void logAction(EActionType uaAction, OrderEntity order) {
////		logAction(uaAction, PojoUtil.copy(new OrderDTO(), order));
////	}
//	@ValidateUser
//	public  void logAction(OrderDTO order,EActionType uaAction) {
//		try {
//	        new ActionLogDTO().setUaType(uaAction)
//				.setPlatformAmt(order.getPlatformAmt())
//				.setIsInfluencer(order.getIsInfluencer())
//				.setAmtCash(order.getAmtCash())
//				.setOrderUuid(order.getUuid())
//				.setOrderNo(order.getNo())
//				.setSum(order.getSum())
//				.setAmt(order.getAmt())
//				.setAmtProduct(order.getAmtProduct())
//				.setAmtProductCoupon(order.getAmtProductCoupon())
//				.setAmtShipping(order.getAmtShipping())
//				.updateRequestInfo()
//				.setUserUuid(order.getUserUuid())
//				.setNewUser(order.getNewUser())
//				.setPlatform(order.getPlatform())
//				.sendToMq();
//		} catch(Exception e) {
//			log.error("logAction OrderDTO failed", e);
//		}
//		List<OrderItemDTO> orderItems = order.getItems();
//        switch(uaAction) {
//			case ORDER_CREATE:
//				orderItems.stream().forEach(orderItem -> {
//					orderItem.setPlatform(order.getPlatform())
//							.setNewUser(order.getNewUser());
//					logAction(EActionType.SKU_ORDER_CREATE, orderItem,order);
//				});
//				break;
//		/*	case ORDER_PAY_FAILED:
//				orderItems.stream().forEach(orderItem -> {
//					orderItem.setPlatform(order.getPlatform())
//							.setNewUser(order.getNewUser());
//					logAction(EActionType.ORDER_PAY_FAILED, orderItem);
//				});
//				break;*/
//			case ORDER_PAY:
//				orderItems.stream().forEach(orderItem -> {
//					orderItem.setPlatform(order.getPlatform()).setNewUser(order.getNewUser());
//					logAction(EActionType.SKU_ORDER_PAY, orderItem,order);
//				});
//				break;
//			case ORDER_UNSHIPPED_CANCEL:
//				orderItems.stream().forEach(orderItem -> {
//					orderItem.setPlatform(order.getPlatform()).setNewUser(order.getNewUser());
//					logAction(EActionType.SKU_UNSHIPPED_CANCEL, orderItem,order);
//				});
//			default:
//				break;
//		}
//	}
//
//	public static void logAction(EActionType uaAction, OrderItemDTO orderItem,OrderDTO order) {
//		try {
//	        new ActionLogDTO().setUaType(uaAction)
//				.setPlatformAmt(orderItem.getPlatformAmtSku())
//				.setIsInfluencer(order.getIsInfluencer())
//				.setAmtCash(orderItem.getAmtCashSku())
//	        	.setProductUuid(orderItem.getProductUuid())
//				.setSkuUuid(orderItem.getSkuUuid())
//				.setSkuNo(orderItem.getSku().getNo())
//				.setSkuColor(orderItem.getSku().getColor())
//				.setSkuSize(orderItem.getSku().getSize())
//				.setQuantity(orderItem.getQuantity())
//				.setAmt(orderItem.getAmt())
//				.setAmtSku(orderItem.getAmtSku())
//				.setAmtShipping(orderItem.getAmtShipping())
//				.updateRequestInfo()
//				.setNewUser(orderItem.getNewUser())
//				.setPlatform(orderItem.getPlatform())
//				.sendToMq();
//		} catch(Exception e) {
//			log.error("logAction OrderItemDTO failed", e);
//		}
//	}
//}
